// 搜索配置
export const searchOption = ref({
  searchBtn: {
    show: false,
  },
  resetBtn: {
    show: false,
  },
  formConfig: {
    tenantId: {
      label: "客户ID",
    },
    customerName: {
      label: "客户名称",
    },
    operationModeId: {
      label: "运营模式",
      component: "el-select",
      dicUrl: Api.mode.GetModeList,
    },
    updateName: {
      label: "操作人员",
    },
    // 开通时间
    createTime: {
      label: "开通时间",
      component: "el-date-picker",
      type: "daterange",
    },
    // 到期时间
    expirationTime: {
      label: "到期时间",
      component: "el-date-picker",
      type: "daterange",
    },
  },
});

// 表格配置
export const tableOption = ref(
  Utils.tools.deleteSearchConfig({
    // 弹窗宽度
    dialogWidth: "30%",
    // 是否显示编辑按钮
    editBtn: false,
    // 是否显示删除按钮
    delBtn: false,
    // 菜单宽度 单个按钮 52px 按钮容器内边距 8px 例如：4个按钮 = 52 * 4 * 8
    menuWidth: 216,
    // 表格配置
    column: {
      // 客户ID
      tenantId: {
        label: "客户ID",
        width: 120,
      },
      // 客户名称
      customerName: {
        label: "客户名称",
        width: 320,
      },
      // 运营模式
      operationModeName: {
        label: "运营模式",
        width: 120,
      },
      // 经营渠道
      businessChannel: {
        label: "经营渠道",
        minWidth: 120,
      },
      // 开通时间
      createTime: {
        label: "开通时间",
        width: 180,
        type: "datetime",
        format: "YYYY-MM-DD HH:mm:ss",
        valueFormat: "YYYY-MM-DD HH:mm:ss",
      },
      // 到期时间
      validityPeriodEnd: {
        label: "到期时间",
        width: 180,
        type: "date",
        format: "YYYY-MM-DD",
        valueFormat: "YYYY-MM-DD HH:mm:ss",
      },
      // 操作人员
      updateName: {
        label: "操作人员",
        width: 120,
      },
      // 续费记录
      renewalRecord: {
        label: "续费记录",
        width: 120,
      },
      // 开通应用数量
      applicationNum: {
        label: "开通应用",
        width: 120,
      },
    },
  })
);

export const customerInfoParams = {
  customerName: "",
  customerContactName: "",
  customerContactPhone: "",
  customerContactEmail: "",
  customerDesc: "",
  companyName: "",
  businessLicenseType: "",
  businessLicenseNo: "",
  businessLicenseAddress: "",
  companyCapital: "",
  validTermType: "",
  businessScope: "",
  businessLicense: "" || [],
  idCardFrontUrl: "" || [],
  idCardBackUrl: "" || [],
  legalPersonName: "",
  legalPersonIdCard: "",
  validityPeriod: "" || [],
  operationModeId: "",
  openFee: "",
  channelCode: [],
  paymentMethod: [],
  contractList: [],
  loginPhone: "",
  verificationCode: "",
  validityPeriodStart: "",
  validityPeriodEnd: "",
  id: "",
};
export const customerInfoForms = [
  {
    itemType: "upload",
    fileList: [],
    prop: "customerLogo",
    label: "客户LOGO",
    tip: "请上传清晰的客户logo，建议尺寸1:1",
    rules: [{ required: true, message: "请上传客户LOGO" }],
    span: 24,
    slotName: "customerLogo",
  },
  {
    itemType: "input",
    span: 8,
    label: "客户名称",
    prop: "customerName",
    maxlength: 20,
    rules: [
      {
        required: "true",
        message: "请输入客户名称",
      },
    ],
  },
  {
    itemType: "input",
    label: "客户联系人姓名",
    span: 8,
    prop: "customerContactName",
    maxlength: 10,
    rules: [
      {
        required: "true",
        message: "请输入客户联系人姓名",
      },
    ],
  },
  {
    itemType: "input",
    label: "客户联系人电话",
    span: 8,
    showWordLimit: false,
    prop: "customerContactPhone",
    rules: [
      {
        required: "true",
        message: "请输入客户联系人电话",
      },
      {
        pattern: /^(((\d{3,4}-)?[0-9]{7,8})|(1(3|4|5|6|7|8|9)\d{9}))$$/,
        message: "请输入正确的手机号码",
      },
    ],
  },
  {
    itemType: "input",
    label: "客户联系人邮箱",
    showWordLimit: false,
    span: 8,
    prop: "customerContactEmail",
    rules: [
      {
        required: "true",
        message: "请输入客户联系人邮箱",
      },
      {
        pattern: /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
        message: "请输入正确的邮箱",
      },
    ],
  },
  {
    itemType: "textarea",
    label: "客户描述(选填)",
    span: 24,
    prop: "customerDesc",
    maxlength: 100,
  },
];
export const EnterpriseInfoForms = [
  {
    itemType: "upload",
    fileList: [],
    prop: "businessLicenseUrl",
    label: "营业执照照片",
    rules: [{ required: true, message: "请上传营业执照照片" }],
    span: 24,
    limit: 1,
    tip: "请上传清晰的营业执照照片，便于系统快速解析信息",
    slotName: "businessLicenseUrl",
  },
  {
    itemType: "input",
    span: 8,
    label: "企业名称",
    prop: "companyName",
    rules: [
      {
        required: "true",
        message: "请输入企业名称",
      },
    ],
    maxlength: 50,
  },
  {
    itemType: "select",
    label: "营业执照类型",
    span: 8,
    prop: "businessLicenseType",
    options: [],
    rules: [
      {
        required: true,
        message: "请选择营业执照类型",
      },
    ],
  },
  {
    itemType: "input",
    label: "统一社会信用代码",
    span: 8,
    prop: "businessLicenseNo",
    rules: [
      {
        required: "true",
        message: "请输入统一社会信用代码",
      },
    ],
    maxlength: 18,
  },
  {
    itemType: "input",
    label: "营业执照地址",
    span: 8,
    prop: "businessLicenseAddress",
    rules: [
      {
        required: "true",
        message: "请输入营业执照地址",
      },
    ],
    maxlength: 100,
  },
  {
    itemType: "input",
    label: "注册资本",
    span: 8,
    prop: "companyCapital",
    rules: [
      {
        required: "true",
        message: "请输入注册资本",
      },
      {
        pattern: /^[\u4e00-\u9fa50-9]+$/,
        message: "请输入正确的注册资本金额",
      },
    ],
  },
  {
    itemType: "select",
    label: "有效期类型",
    span: 8,
    prop: "validTermType",
    options: [],
    dictCode: "qingyun.support.customer.validityPeriodType",
    rules: [
      {
        required: true,
        message: "请选择有效期类型",
      },
    ],
  },
  // 有效期类型
  {
    itemType: "textarea",
    label: "经营范围",
    span: 24,
    prop: "businessScope",
    maxlength: 1000,
    rules: [{ required: true, message: "请输入经营范围" }],
  },
  {
    itemType: "date",
    label: "营业执照有效期",
    type: "daterange",
    prop: "businessLicense",
    valueFormat: "YYYY-MM-DD",
    span: 8,
    rules: [
      {
        required: true,
        message: "请选择营业执照有效期",
      },
    ],
  },
];
export const corporateIdentityInfoForms = [
  {
    itemType: "upload",
    fileList: [],
    prop: "idCardFrontUrl",
    label: "身份证头像面",
    class: "card-upload",
    svgType: 2,
    rules: [{ required: true, message: "请上传身份证头像面" }],
    span: 12,
    limit: 1,
    slotName: "idCardFrontUrl",
  },
  {
    itemType: "upload",
    fileList: [],
    prop: "idCardBackUrl",
    class: "card-upload",
    label: "身份证国徽面",
    svgType: 3,
    rules: [{ required: true, message: "请上传身份证国徽面" }],
    span: 12,
    limit: 1,
    slotName: "idCardBackUrl",
  },
  {
    itemType: "input",
    label: "法人姓名",
    prop: "legalPersonName",
    span: 12,
    rules: [
      {
        required: true,
        message: "请输入姓名",
      },
    ],
    maxlength: 10,
  },
  {
    itemType: "input",
    label: "法人身份证号",
    prop: "legalPersonIdCard",
    span: 12,
    rules: [
      {
        required: true,
        message: "请输入身份证号",
      },
      {
        pattern: /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
        message: "请输入正确的身份证号",
      },
    ],
  },
];
export const activateInfoForms = [
  {
    itemType: "date",
    prop: "validityPeriod",
    label: "使用有效期",
    type: "daterange",
    valueFormat: "YYYY-MM-DD",
    rules: [
      {
        required: true,
        message: "请选择使用有效期",
      },
    ],
    span: 8,
  },
  {
    itemType: "select",
    label: "运营模式",
    span: 8,
    prop: "operationModeId",
    options: [],
    rules: [
      {
        required: true,
        message: "请选择运营模式",
      },
    ],
  },
  {
    itemType: "input",
    label: "开通费用",
    span: 8,
    prop: "openFee",
    rules: [
      { required: true, message: "请输入开通费用" },
      {
        pattern: /^[\u4e00-\u9fa50-9]+$/,
        message: "请输入正确的金额",
      },
    ],
  },
  {
    itemType: "cascader",
    span: 8,
    label: "经营类目",
    options: [],
    props: {
      label: "name",
      value: "id",
      multiple: true,
      checkStrictly: false,
    },
    rules: [{ required: false, message: "请选择经营类目" }],
    prop: "businessCategory",
  },
  {
    itemType: "checkbox",
    label: "经营渠道",
    span: 24,
    prop: "channelCode",
    options: [
      { value: "01", label: "微信小程序" },
      { value: "02", label: "支付宝小程序" },
      { value: "03", label: "快手小程序" },
      { value: "04", label: "App" },
    ],
    rules: [{ required: true, message: "请选择经营渠道" }],
  },

  {
    itemType: "checkbox",
    label: "支付方式",
    span: 24,
    prop: "paymentMethod",
    options: [
      { value: "01", label: "微信支付" },
      { value: "02", label: "支付宝支付" },
    ],
    rules: [{ required: true, message: "请选择支付方式" }],
  },

  {
    itemType: "upload",
    label: "合同(可上传多张)",
    prop: "contractList",
    span: 8,
    fileList: [],
    rules: [{ required: true, message: "请上传合同" }],
    slotName: "contractList",
  },
];
export const loginInfoForms = [
  {
    itemType: "input",
    label: "登录手机号",
    prop: "loginPhone",
    span: 8,
    disabled: false,
    rules: [
      { required: true, message: "请输入登录手机号" },
      {
        pattern: /^1[3456789]\d{9}$/,
        message: "请输入正确的手机号",
      },
    ],
  },
  {
    itemType: "input",
    span: 8,
    label: "验证码",
    prop: "verificationCode",
    showWordLimit: false,
    // append: "获取验证码",
    hidden: false,
    rules: [{ required: true, message: "请输入验证码" }],
  },
];
